Uso del contexto de firewall de netsh advfirewall

您所在的位置:网站首页 netsh firewall set icmpsetting Uso del contexto de firewall de netsh advfirewall

Uso del contexto de firewall de netsh advfirewall

2024-02-08 06:49| 来源: 网络整理| 查看: 265

Usar el firewall netsh advfirewall en lugar del firewall de netsh para controlar el comportamiento del firewall de Windows Art铆culo 07/17/2023

En este art铆culo se describe c贸mo usar el contexto de netsh advfirewall firewall en lugar del contexto para controlar el netsh firewall comportamiento de Firewall de Windows.

Se aplica a: Windows Server 2012 R2 N煤mero de KB original: 947709

Resumen

El netsh advfirewall contexto de la l铆nea de comandos del firewall est谩 disponible en Windows Server 2012 R2. Este contexto proporciona la funcionalidad para controlar el comportamiento de Firewall de Windows proporcionado por el contexto de netsh firewall firewall.

Este contexto tambi茅n proporciona funcionalidad para un control m谩s preciso de las reglas de firewall. Estas reglas incluyen la siguiente configuraci贸n por perfil:

Dominio Private Public

El netsh firewall contexto de la l铆nea de comandos podr铆a estar en desuso en una versi贸n futura del sistema operativo Windows. Se recomienda usar el contexto de firewall para controlar el netsh advfirewall comportamiento del firewall.

Importante

Si es miembro del grupo Administradores y el Control de cuentas de usuario est谩 habilitado en el equipo, ejecute los comandos desde un s铆mbolo del sistema con permisos elevados. Para iniciar un s铆mbolo del sistema con permisos elevados, busque el icono o la entrada del men煤 Inicio que use para iniciar una sesi贸n del s铆mbolo del sistema, haga clic con el bot贸n derecho en 茅l y, a continuaci贸n, haga clic en Ejecutar como administrador.

En las tablas siguientes se proporcionan algunos ejemplos de comandos usados con frecuencia. Puede usar estos ejemplos para ayudarle a migrar desde el contexto anterior netsh firewall al nuevo netsh advfirewall contexto de firewall.

Adem谩s, se proporcionan los netsh advfirewall comandos que puede usar para obtener ayuda en l铆nea detallada.

Ejemplo de comando 1: Habilitar un programa Comando anterior Nuevo comando netsh firewall add allowedprogram C:\MyApp\MyApp.exe "My Application" ENABLE netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:\MyApp\MyApp.exe" enable=yes netsh firewall add allowedprogram program=C:\MyApp\MyApp.exe name="My Application" mode=ENABLE scope=CUSTOM addresses=157.60.0.1,172.16.0.0/16,LocalSubnet profile=Domain netsh advfirewall firewall add rule name="My Application" dir=in action=allow program= "C:\MyApp\MyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain netsh firewall add allowedprogram program=C:\MyApp\MyApp.exe name="My Application" mode=ENABLE scope=CUSTOM addresses=157.60.0.1,172.16.0.0/16,LocalSubnet profile=ALL Ejecute los comandos siguientes:netsh advfirewall firewall add rule name="My Application" dir=in action=allow program= "C:\MyApp\MyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domainnetsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:\MyApp\MyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=private

Para obtener m谩s informaci贸n sobre c贸mo agregar reglas de firewall, ejecute el siguiente comando:

netsh advfirewall firewall add rule ? Ejemplo de comando 2: Habilitar un puerto Comando anterior Nuevo comando netsh firewall add portopening TCP 80 "Open Port 80" netsh advfirewall firewall add rule name= "Open Port 80" dir=in action=allow protocol=TCP localport=80

Para obtener m谩s informaci贸n sobre c贸mo agregar reglas de firewall, ejecute el siguiente comando:

netsh advfirewall firewall add rule ? Ejemplo de comando 3: Eliminaci贸n de puertos o programas habilitados Comando anterior Nuevo comando netsh firewall delete allowedprogram C:\MyApp\MyApp.exe netsh advfirewall firewall delete rule name= rule name program="C:\MyApp\MyApp.exe" delete portopening protocol=UDP port=500 netsh advfirewall firewall delete rule name= rule name protocol=udp localport=500

Para obtener m谩s informaci贸n sobre c贸mo eliminar reglas de firewall, ejecute el siguiente comando:

netsh advfirewall firewall delete rule ? Ejemplo de comando 4: Configuraci贸n de valores icmp Comando anterior Nuevo comando netsh firewall set icmpsetting 8 netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow netsh firewall set icmpsetting type=ALL mode=enable netsh advfirewall firewall add rule name= "All ICMP V4" protocol=icmpv4:any,any dir=in action=allow netsh firewall set icmpsetting 13 disable all netsh advfirewall firewall add rule name="Block Type 13 ICMP V4" protocol=icmpv4:13,any dir=in action=block

Para obtener m谩s informaci贸n sobre c贸mo configurar las opciones de ICMP, ejecute el siguiente comando:

netsh advfirewall firewall add rule ? Ejemplo de comando 5: Establecer registro Comando anterior Nuevo comando netsh firewall set logging %systemroot%\system32\LogFiles\Firewall\pfirewall.log 4096 ENABLE ENABLE Ejecute los comandos siguientes:netsh advfirewall set currentprofile logging filename %systemroot%\system32\LogFiles\Firewall\pfirewall.lognetsh advfirewall set currentprofile logging maxfilesize 4096netsh advfirewall set currentprofile logging droppedconnections enablenetsh advfirewall set currentprofile logging allowedconnections enable

Para obtener m谩s informaci贸n, ejecute el siguiente comando:

netsh advfirewall set currentprofile ?

Si desea establecer el registro para un perfil determinado, use una de las siguientes opciones en lugar de la currentprofile opci贸n :

Domainprofile Privateprofile Publicprofile Ejemplo de comando 6: Habilitar firewall de Windows Comando anterior Nuevo comando netsh firewall set opmode ENABLE netsh advfirewall set currentprofile state on netsh firewall set opmode mode=ENABLE exceptions=enable Ejecute los comandos siguientes:Netsh advfirewall set currentprofile state onnetsh advfirewall set currentprofile firewallpolicy blockinboundalways,allowoutbound netsh firewall set opmode mode=enable exceptions=disable profile=domain Ejecute los comandos siguientes: Netsh advfirewall set domainprofile state onnetsh advfirewall set domainprofile firewallpolicy blockinbound,allowoutbound netsh firewall set opmode mode=enable profile=ALL Ejecute los comandos siguientes: netsh advfirewall set domainprofile state onnetsh advfirewall set privateprofile state on

Para obtener m谩s informaci贸n, ejecute el siguiente comando:

netsh advfirewall set currentprofile ?

Si desea establecer el estado del firewall para un perfil determinado, use una de las siguientes opciones en lugar de la currentprofile opci贸n :

Domainprofile Privateprofile Publicprofile Ejemplo de comando 7: Restauraci贸n de valores predeterminados de directiva Comando anterior Nuevo comando netsh firewall reset netsh advfirewall reset

Para obtener m谩s informaci贸n, ejecute el siguiente comando:

netsh advfirewall reset ? Ejemplo de comando 8: Habilitar servicios espec铆ficos Comando anterior Nuevo comando netsh firewall set service FileAndPrint netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes netsh firewall set service RemoteDesktop enable netsh advfirewall firewall set rule group="remote desktop" new enable=Yes netsh firewall set service RemoteDesktop enable profile=ALL Ejecute los comandos siguientes:

netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=domain

netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=private



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3